package com.woniu108.order.client;

import com.woniu108.carService.commos.dto.UserTicketDto;
import com.woniu108.carService.commos.dto.UserVipDto;
import com.woniu108.carService.commos.model.Result;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author LY
 */
@FeignClient(name = "value-added-server",path = "/value-added")
public interface ValueAddedClient {
    /**
     * 查询用户使用的优惠卷信息（判定用户是否持有该优惠卷）
     * @param userId 用户ID
     * @param ticketId 优惠券种类ID
     * @return UserTicketDto 用户持有的对应种类优惠券信息(含持有数量)
     */
    @GetMapping("/ticket/checkUserTicketId")
    @ApiOperation("用户持有的单种优惠券信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId",value ="用户ID" ),
            @ApiImplicitParam(name = "ticketId",value ="优惠券种类ID" )
    })
    Result<UserTicketDto> checkUserTicketId(@RequestParam("userId") String userId, @RequestParam("ticketId")Integer ticketId);

    /**
     * 根据用户编号获取用户vip详细信息
     * @param userId 用户ID
     * @return UserVipDto 用户vip详细信息
     */
    @GetMapping("/userVip/getUserVipInfo/{userId}.c")
    @ApiOperation("根据用户编号获取用户vip详细信息")
    @ApiImplicitParam(name = "userId",value = "用户ID")
    public Result<UserVipDto> getUserVipInfo(@PathVariable("userId")String userId);

    /**
     * 消耗用户选择使用数量的优惠券
     * @param userId 用户ID
     * @param ticketId 优惠券种类ID
     * @param number 使用数量
     * @return result 接口是否正常访问结果
     */
    @GetMapping("/ticket/reduceUserTicket.api")
    @ApiOperation("消耗用户选择使用数量的优惠券")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId",value ="用户ID" ),
            @ApiImplicitParam(name = "ticketId",value ="优惠券种类ID" ),
            @ApiImplicitParam(name = "number",value ="使用数量" )
    })
    public Result reduceUserTicket(@RequestParam("userId") String userId,@RequestParam("ticketId")Integer ticketId,@RequestParam("number")Integer number);

    /**
     * 扣减免费次数
     * @param userId 用户编号
     * @return result 是否正常访问接口结果
     */
    @GetMapping("/userVip/reduceFreeNum.c")
    public Result reduceFreeNum(@RequestParam("userId")String userId);
}
